//
//  SDKEntryAccount.m
//  IMSAccountDemo
//
//  Created by 文季 on 2017/11/17.
//  Copyright © 2017年 Aliyun.com. All rights reserved.
//

#import "SDKEntryAccount.h"
#import <UIKit/UIKit.h>
#import <IMSAccount/IMSAccount.h>
#import "IMSOpenAccount.h"
#import <IMSAuthentication/IMSAuthentication.h>

@protocol IMSSDKEntryProtocol<NSObject>

@required
+ (NSDictionary *)getSDKDisplayConfig;
+ (void)didSelected:(NSNumber *)selectedIndex from:(UINavigationController *)navigation;
+ (void)SDKEntryInit;
+ (float)getInitLevel;

@end

@interface SDKEntryAccount ()<IMSSDKEntryProtocol>

@end

@implementation SDKEntryAccount

+ (NSDictionary *)getSDKDisplayConfig {
    return @{
        @"DisplayName" : @"账号和用户",
        @"Actions" : @[ @"界面展示" ],
        @"DisplayLevel" : @"3",
    };
}

+ (void)didSelected:(NSNumber *)selectedIndex from:(UINavigationController *)navigation {
}

+ (void)SDKEntryInit {
    IMSOpenAccount *openAccount = [IMSOpenAccount sharedInstance];
    [IMSAccountService sharedService].sessionProvider = openAccount;
    [IMSAccountService sharedService].accountProvider = openAccount;

    // 设置使用IoT用户统一身份认证
    IMSAccountService *accountService = [IMSAccountService sharedService];
    [IMSCredentialManager initWithAccountProtocol:accountService.sessionProvider];
    IMSIoTAuthentication *iotAuthDelegate = [[IMSIoTAuthentication alloc] initWithCredentialManager:IMSCredentialManager.sharedManager];
    [IMSRequestClient registerDelegate:iotAuthDelegate forAuthenticationType:IMSAuthenticationTypeIoT];
}

+ (float)getInitLevel {
    return 1.3;
}

@end
